Field of the Invention
The present invention relates to an image processing technique for estimating a focusing distance using a plurality of photographed images.
Description of the Related Art
A technique for generating an image of which depth of field is shallow from an image of which depth of field is deep using image processing is known (e.g. Japanese Patent Application Laid-Open No. H7-021365, Japanese Patent Application Laid-Open No. H9-181966). To generate an image of which depth of field is shallow, a depth map representing a distance distribution of an object is created, a main object and a background are separated from each other based on the created depth map, and only the background image is blurred.
A generally used method for creating a depth map is analyzing a plurality of photographed images. Concrete examples are the depth from defocus (DFD) method which estimates a distance based on a difference of a degree of blur of a plurality of images photographed with different focusing positions, and a stereo method which estimates a distance from the correspondence of pixels among the images based on the principle of triangulation. These methods are called “passive methods”, whereas active methods acquire a distance by irradiating ultrasound, infrared or the like onto an object when capturing an image, and are widely used since no special apparatus is required.
However these passive methods are used for analyzing photographed images, hence depending on a photographed scene, accurately estimating a distance of an object may be difficult. In the case of the DFD method, there is no need to search the correspondence among pixels, unlike the stereo method, but an incorrect depth map may be generated if an area where blur hardly appears exists in an image, since the distance is calculated based on the blur in the image.
If an image of which depth of field is shallow is generated using an incorrect depth map, a correct blurring effect cannot be acquired in an area where a correct depth map is not determined. In other words, image quality deterioration, which is visually unacceptable, is generated, such as a main object area which should not be blurred is blurred, and a background area to be blurred is not blurred.